//
//  NBAClubGameDept.swift
//  NBA
//
//  Created by tiger on 2018/3/6.
//  Copyright © 2018年 Meigabay. All rights reserved.
//

import UIKit

public class NBAClubGameDept: NBADepartment {
    
    internal weak var game: NBAGame?
    public private(set) var workingPlayers: [NBAPlayer]! //正在出战中的球员
    internal weak var c: NBAPlayer!
    internal weak var pf: NBAPlayer!
    internal weak var sf: NBAPlayer!
    internal weak var sg: NBAPlayer!
    internal weak var pg: NBAPlayer!
    
    internal func startGame(game: NBAGame,players: [NBAPlayer]) {
        self.game = game
        self.workingPlayers = players
        for player in self.workingPlayers {
            switch player.position {
                case .c:
                    self.c = player
                    break;
                case .pf:
                    self.pf = player
                    break;
                case .sf:
                    self.sf = player
                    break;
                case .sg:
                    self.sg = player
                    break;
                case .pg:
                    self.pg = player
                    break;
            }
            player.startWork(game: game)
        }
    }
    
}
